<?php
error_reporting(0); 
include("../include/os.php");
include("../config/common.php");
include("../config/conn.php");
$i=rand(1,40);
$cishu=rand(1,10000);
$hurl = $_SERVER['HTTP_REFERER'];//来源;
$wangzhi = $_SERVER['SERVER_NAME'];
$userid=$_COOKIE[uid];
if($userid==null){
echo "<script>location.href='login.php'</script>";
exit;
}else{;
    $type="where userid='$userid'";
    $neirong=queryall(ubouser,$type);
    $uid = $neirong['id'];
    $type="where uid='$uid'";
    $agent=dbquery(ubofx,$type);
    if(!$agent)
    {
        $post =$_POST['post'];
        if($post){

            $addtime = time();
            $level = 1;
            $user = $neirong['user'];
            $type="(`id`, `uid`, `level`, `addtime`, `user`, `status`) VALUES (null,'$uid','$level','$addtime','$user',1)";
            $res = dbinsert(ubofx,$type);
            if($res){
                echo "<script>location.href='/user/user_pay.php'</script>";
            }
    }


}

$type="where userid='$userid'";
$neirong=queryall(ubouser,$type);
?>
<!DOCTYPE html>
<html>
<head>
<title>会员中心-申请代理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<meta name="format-detection" content="telephone=no">
<SCRIPT language=javascript src="/app/layer/jquery-1.9.1.min.js"></SCRIPT>
<SCRIPT language=javascript src="/app/layer/layer.js"></SCRIPT>
<?php if ($zhifu==5){?>
<script type="text/javascript">
$(document).ready(function()
{
    $("#pay label").click(function()
    {
		var id=$(this).attr('id');
        document.getElementById('fee').value=id;
    });
});  
</script>
<?php }?> 
<?php include_once('../include/css.php'); ?> 
<style>
.open_vip{
background-color: lightcyan;;
}
.ui-border li i em{
font-size: 0.75rem;
}
.aboutpic li{
margin-top: 0.6rem
}
.aboutpic li i img{
width: 2.5rem;
height: 2.5rem;
}

.qx {color: #999;}

</style>
</head>
<body>
<div id="head" >
<div class="fixtop">
<span id="home"><a href="/" rel="external"><i class="ico08"><img src="/img/homepage.png" width="30px" /></i></a></span>
<span id="index"><i class="ico07"><img src="/img/logo.png" width="88px" class="h" /></i></span><i class="ico21">申请代理</i>
<span id="find"><i class="ico08"><img src="/img/ss1.png" width="29px" /></i></span>
</div>
<?php include_once('../include/column.php'); ?>
<div id="nav" class="view currents out">
<div id="search-box">
<form method="get" action="/vod_list.php" data-ajax="false" id="search-form">
<div class="box-search">
<span class="icon-search icon"></span>
<input x-webkit-speech type="text"  placeholder="请输入视频关键字" autocomplete="off" value="" name="k" id="k"/>
</div>
<div class="search_submit"><button type="submit" >
<i class="ico01"></i>搜索
</button>
</div>
</form>
</div>
<?php include_once('../include/nav_s.php'); ?>
</div>
</div>
<header id="header" class="ui-header ui-header-positive ui-border-b" >
<h1></h1>
</header>
<section class="jilu" style=" margin-top:46px;">
<a href="user_pay.php">
        <li>
            <h2 class="t2 l" style="padding-top:1.5%;color:red;"><img src="/img/ustb.png" width="12" height="12" style="margin-right:5px;">申请代理</h2>
            <span class="r login_yj"> &gt; </span>
        </li>
    </a>
<a href="user_pay_list.php">
<li>
<h2 class="t2 l" style="padding-top:1.5%;"><img src="/img/ustb.png" width="12" height="12" style="margin-right:5px;">财务记录</h2>
<span class="r login_yj"> &gt; </span>
</li>
</a> 
</section>
<div style="display:none"><iframe id="msgubotj" name="msgubotj" width=0 height=0></iframe></div> 
<section class="jilu" style="margin-top: 2.2%;"> 
<form id="Form1" method="post" action="" style="padding:0 10px;target="msgubotj">
<table width="100%" border="0" cellpadding="5" cellspacing="5">
<tbody>
<?php if(empty($agent)){?>
<tr>

<td height="60" align="center" valign="middle">
<input type="hidden" value="1" name="post">
<input type="submit" id="submit" value="申请代理" class="user_reg_but" style="width:120px;">
</td>
</tr>
<?php }else{?>
<tr>
<td height="60" align="center" valign="middle">申请时间</td>
<td height="60" align="center" valign="middle">审核状态</td>
</tr>
 <?php foreach ($agent as $vo){
     if($vo['status']==0){
         $vo['status'] ='待审核';
     }elseif($vo['status']==2){
         $vo['status'] ='开通成功';
     }else{
         $vo['status'] ='待审核';
     }
        $vo['addtime'] = date('Y-m-d H:i:s',$vo['addtime']);

     ?>

<tr>
    <td height="60" align="center" valign="middle"><?=$vo['addtime']?></td>
    <td height="60" align="center" valign="middle"><?=$vo['status']?></td>
</tr>
<?php }}?>

</tbody>
</table>
</form>
</section>
<?php include_once('../include/foot.php'); ?> 
<?php include_once('user_bottom.php'); ?> 
</body>
</html>
<?php }?> 